//FibTest.java
package _07recursion;

public class FibTest {
    private static int sum = 0;

    public static int fib(int n){

        // 递归的终止条件
        if(n == 0) return 0;
        if(n == 1) return 1;

        // 处理当前逻辑， 下探
        sum = fib(n - 1) + fib(n - 2);

        return sum;
    }

    public static void main(String[] args) {
        System.out.println(fib(0));
        System.out.println(fib(1));
        System.out.println(fib(2));
        System.out.println(fib(3));
        System.out.println(fib(4));
        System.out.println(fib(5));
        System.out.println(fib(6));
        System.out.println(fib(7));
        System.out.println(fib(10));


    }
}
